#include <stdio.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/types.h>

#define PATH_NAME "./"
#define PROJ_ID 0x6666
#define SIZE 4096

int main()
{
    key_t key = ftok(PATH_NAME, PROJ_ID);
    if(key < 0){
        perror("ftok");
        return 1;
    }
    int shmid = shmget(key, SIZE, IPC_CREAT | IPC_EXCL);
    if(shmid < 0){
        perror("shmget");
        return 2;
    }
    printf("key: %u  shmid: %d\n", key, shmid);
    return 0;
}
